#!/bin/bash

echo "检查KiteMusic项目编译状态..."
echo

# 检查当前目录
if [ ! -f "gradlew" ] && [ ! -f "gradlew.bat" ]; then
    echo "❌ gradlew 文件不存在"
    echo "请确保在正确的项目目录中运行此脚本"
    exit 1
fi

echo "清理之前的构建文件..."
./gradlew clean

echo
echo "开始编译项目..."
./gradlew assembleDebug

if [ $? -eq 0 ]; then
    echo
    echo "✅ 编译成功！"
    echo
    echo "生成的文件位置："
    ls -la app/build/outputs/apk/debug/*.apk 2>/dev/null || echo "没有找到APK文件"
else
    echo
    echo "❌ 编译失败！"
    echo "请检查上述错误信息并修复问题"
fi

echo
